<script setup lang="ts">
//modal组件
/**
 * 灵感：
 * https://ai.nav6.cn/1095.Ai 子比主题
 * https://blog.csdn.net/jiang7701037/article/details/97568201
 * https://www.producthunt.com/posts/gridea-2
 */
defineProps<{ clickActive: Function }>();
</script>
<template>
  <div class="modal-backdrop">
    <div class="modal-position">
      <div class="modal">
        <div class="modal-header">
          <slot name="header"></slot>
          <button type="button" class="btn-close" @click="clickActive()">
            关闭
          </button>
        </div>
        <div class="modal-body">
          <slot></slot>
        </div>
        <!--
<div class="modal-footer">
        <button type="button" class="btn-close" @click="clickActive()">
          关闭
        </button>
      </div>
      --></div>
    </div>
  </div>
</template>
<style scoped lang="less">
.modal-backdrop {
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: transparent;
  background: rgba(0, 0, 0, 0.7);
  bottom: 0;
  left: 0;
  overflow: auto;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 30;
}
.modal-position {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 40px 20px;
}
.modal {
  background-color: #fff;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  width: 700px;
 

  overflow: hidden;
}
.modal-header {
  border-bottom: 1px solid #eee;
  color: #313131;
  justify-content: space-between;
  padding: 15px;
  display: flex;
}
.modal-footer {
  border-top: 1px solid #eee;
  justify-content: flex-end;
  padding: 15px;
  display: flex;
}
.modal-body {
  position: relative;
  padding: 6px 10px;
}
.btn-close,
.btn-confirm {
  border-radius: 8px;
  margin-left: 16px;
  width: 56px;
  height: 36px;
  border: none;
  cursor: pointer;
}
.btn-close {
  color: #313131;
  background-color: transparent;
}
.btn-confirm {
  color: #fff;
  background-color: #2d8cf0;
}

@media (min-width: 1400px){
  .modal{
    min-width: 1200px;
  }
}
</style>
